home *** CD-ROM | disk | FTP | other *** search
/ PC Format (PL) 2008 December / PC_Format_122008.iso / Multimedia / MediaPortal 0.2.3.0 / MediaPortal_0.2.3.0_Setup.exe / scripts / imdb / imdb_com.csscript < prev    next >
Text File  |  2007-10-10  |  19KB  |  559 lines

  1. //css_reference "core.dll";
  2. //css_reference "Databases.dll";
  3. //css_reference "utils.dll";
  4.  
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Text;
  11. using System.Windows.Forms;
  12. using System.IO;
  13. using System.Net;
  14. using System.Collections;
  15. using System.Web;
  16. using System.Text.RegularExpressions;
  17. using MediaPortal.Util;
  18.  
  19. class Grabber : MediaPortal.Video.Database.IIMDBScriptGrabber
  20. {
  21.   public Grabber()
  22.     {
  23.     }
  24.   void MediaPortal.Video.Database.IIMDBScriptGrabber.FindFilm(string strSearch, int iLimit, ArrayList elements)
  25.   {
  26.     int iCount = 0;
  27.     string strTitle;
  28.     try
  29.     {
  30.       string absoluteUri;
  31.       string strURL = "http://us.imdb.com/Tsearch?title=" + strSearch;
  32.       string strBody = GetPage(strURL, "utf-8", out absoluteUri);
  33.  
  34.       // Mars Warrior @ 03-sep-2004.
  35.       // First try to find an Exact Match. If no exact match found, just look
  36.       // for any match and add all those to the list. This narrows it down more easily...
  37.       int iStartOfMovieList = strBody.IndexOf("Popular Titles");
  38.       if (iStartOfMovieList < 0) iStartOfMovieList = strBody.IndexOf("Exact Matches");
  39.       if (iStartOfMovieList < 0) iStartOfMovieList = strBody.IndexOf("Partial Matches");
  40.       if (iStartOfMovieList < 0) iStartOfMovieList = strBody.IndexOf("Approx Matches");
  41.  
  42.         int endOfTitleList = strBody.IndexOf("Suggestions For Improving Your Results");
  43.         if (iStartOfMovieList < 0)
  44.         {
  45.           int iMovieTitle = strBody.IndexOf("<title>");
  46.           int iOverview = strBody.IndexOf("Overview");
  47.           int iMovieGenre = strBody.IndexOf("Genre:");
  48.           int iMoviePlot = strBody.IndexOf("Plot");
  49.  
  50.           if (iMovieTitle >= 0 && iOverview >= 0 && iMoviePlot >= 0)
  51.           {
  52.             int iEnd = strBody.IndexOf("<", iMovieTitle + 7);
  53.             if (iEnd > 0)
  54.             {
  55.               iMovieTitle += "<title>".Length;
  56.               strTitle = strBody.Substring(iMovieTitle, iEnd - iMovieTitle);
  57.               strTitle = MediaPortal.Util.Utils.stripHTMLtags(strTitle);
  58.               HTMLUtil htmlUtil = new HTMLUtil();
  59.               htmlUtil.ConvertHTMLToAnsi(strTitle, out strTitle);
  60.               MediaPortal.Video.Database.IMDB.IMDBUrl url = new MediaPortal.Video.Database.IMDB.IMDBUrl(strURL, strTitle + " (imdb)", "IMDB");
  61.               elements.Add(url);
  62.             }
  63.           }
  64.           return;
  65.         }
  66.  
  67.       iStartOfMovieList += "<table>".Length;
  68.       int iEndOfMovieList = strBody.IndexOf("</table>", iStartOfMovieList);
  69.  
  70.       if (iEndOfMovieList < 0)
  71.       {
  72.         iEndOfMovieList = strBody.Length;
  73.       }
  74.       if (endOfTitleList < iEndOfMovieList && endOfTitleList > iStartOfMovieList)
  75.       {
  76.         iEndOfMovieList = endOfTitleList;
  77.       }
  78.       strBody = strBody.Substring(iStartOfMovieList, iEndOfMovieList - iStartOfMovieList);
  79.       while ((true) && (iCount < iLimit))
  80.       {
  81.         ////<A HREF="/Title?0167261">Lord of the Rings: The Two Towers, The (2002)</A>
  82.         int iAHREF = strBody.IndexOf("<a href=");
  83.         if (iAHREF >= 0)
  84.         {
  85.           int iEndAHREF = strBody.IndexOf("</a>");
  86.           if (iEndAHREF >= 0)
  87.           {
  88.             iAHREF += "<a href=.".Length;
  89.             string strAHRef = strBody.Substring(iAHREF, iEndAHREF - iAHREF);
  90.             int iURL = strAHRef.IndexOf(">");
  91.             if (iURL > 0)
  92.             {
  93.               strTitle = "";
  94.               strURL = strAHRef.Substring(0, iURL);
  95.               if (strURL[strURL.Length - 1] == '\"')
  96.                 strURL = strURL.Substring(0, strURL.Length - 1);
  97.               iURL++;
  98.               int iURLEnd = strAHRef.IndexOf("<", iURL);
  99.               if (iURLEnd > 0)
  100.               {
  101.                 strTitle = strAHRef.Substring(iURL, iURLEnd - iURL);
  102.               }
  103.               else
  104.                 strTitle = strAHRef.Substring(iURL);
  105.  
  106.               int onclick = strURL.IndexOf(" onclick");
  107.               if (onclick >= 0)
  108.                 strURL = strURL.Substring(0, onclick - 1);
  109.               strURL = String.Format("http://us.imdb.com{0}", strURL);
  110.               HTMLUtil htmlUtil = new HTMLUtil();
  111.               htmlUtil.ConvertHTMLToAnsi(strTitle, out strTitle);
  112.  
  113.  
  114.               int endTagLength = "</a>".Length;
  115.               int posNextTag = strBody.IndexOf("<", iEndAHREF + endTagLength);
  116.               if (posNextTag > 0)
  117.               {
  118.                 string strSub = strBody.Substring(iEndAHREF + endTagLength, posNextTag - (iEndAHREF + endTagLength));
  119.                 strTitle += strSub;
  120.               }
  121.               // to avoid including of   
  122.               if ((strTitle.IndexOf("\n") < 0) && (strTitle.IndexOf(" ") < 0))
  123.               {
  124.                 MediaPortal.Video.Database.IMDB.IMDBUrl url = new MediaPortal.Video.Database.IMDB.IMDBUrl(strURL, strTitle + " (imdb_com)", "imdb_com");
  125.                 elements.Add(url);
  126.               }
  127.               iCount++;
  128.             }
  129.             if (iEndAHREF + 1 >= strBody.Length)
  130.               break;
  131.             iStartOfMovieList = iEndAHREF + 1;
  132.             strBody = strBody.Substring(iEndAHREF + 1);
  133.           }
  134.           else
  135.           {
  136.             break;
  137.           }
  138.         }
  139.         else
  140.         {
  141.           break;
  142.         }
  143.       }
  144.     }
  145.     catch (Exception ex)
  146.     {
  147.       MediaPortal.GUI.Library.Log.Error("exception for imdb lookup of {0} err:{1} stack:{2}",strSearch, ex.Message, ex.StackTrace);
  148.     }
  149.   }
  150.  
  151.   bool MediaPortal.Video.Database.IIMDBScriptGrabber.GetDetails(MediaPortal.Video.Database.IMDB.IMDBUrl url, ref MediaPortal.Video.Database.IMDBMovie movieDetails)
  152.   {
  153.     try
  154.     {
  155.  
  156.       int iStart = 0;
  157.       int iEnd = 0;
  158.       movieDetails.Reset();
  159.       // add databaseinfo
  160.       // may add an another grabber  
  161.       movieDetails.Database = "imdb_com";
  162.  
  163.       string strAbsURL;
  164.       string strBody = GetPage(url.URL, "utf-8", out strAbsURL);
  165.       if (strBody == null || strBody.Length == 0)
  166.         return false;
  167.  
  168.       int iPos = strAbsURL.IndexOf("/title/");
  169.       if (iPos > 0)
  170.       {
  171.         iPos += "/title/".Length;
  172.         movieDetails.IMDBNumber = strAbsURL.Substring(iPos);
  173.         int pos = movieDetails.IMDBNumber.IndexOf("/");
  174.         if (pos > 0)
  175.           movieDetails.IMDBNumber = movieDetails.IMDBNumber.Substring(0, pos);
  176.       }
  177.  
  178.       url.Title = url.Title.Trim();
  179.       // cut of " (imdb)"
  180.       iEnd = url.Title.IndexOf("(");
  181.       if (iEnd >= 0)
  182.         movieDetails.Title = url.Title.Substring(0, iEnd);
  183.       else
  184.         movieDetails.Title = url.Title;
  185.       movieDetails.Title = movieDetails.Title.Trim();
  186.       string movieTitle = System.Web.HttpUtility.HtmlEncode(movieDetails.Title);
  187.       int iDirectedBy = strBody.IndexOf("Director");
  188.       int iCredits = strBody.IndexOf("Writer");
  189.       int iGenre = strBody.IndexOf("Genre:");
  190.       int iTagLine = strBody.IndexOf("Tagline:</h5>");
  191.       int iPlotOutline = strBody.IndexOf("Plot Outline:</h5>");
  192.       int iPlotSummary = strBody.IndexOf("Plot Summary:</h5>");
  193.       int iPlot = strBody.IndexOf("<a href=\"plotsummary");
  194.       int iImage = strBody.IndexOf("<img border=\"0\" alt=\"" + movieTitle + "\" title=\"" + movieTitle + "\" src=\"");
  195.       if (iImage >= 0)
  196.       {
  197.         iImage += ("<img border=\"0\" alt=\"" + movieTitle + "\" title=\"" + movieTitle + "\" src=\"").Length;
  198.       }
  199.       int iRating = strBody.IndexOf("User Rating:</b>");
  200.       int iCred = strBody.IndexOf("<table class=\"cast\">");
  201.       int iTop = strBody.IndexOf("Top 250:");
  202.       int iYear = strBody.IndexOf("/Sections/Years/");
  203.       if (iYear >= 0)
  204.       {
  205.         iYear += "/Sections/Years/".Length;
  206.         string strYear = strBody.Substring(iYear, 4);
  207.         movieDetails.Year = System.Int32.Parse(strYear);
  208.       }
  209.  
  210.       if (iDirectedBy >= 0)
  211.         movieDetails.Director = ParseAHREFIMDB(strBody, iDirectedBy, url.URL).Trim();
  212.  
  213.       if (iCredits >= 0)
  214.         movieDetails.WritingCredits = ParseAHREFIMDB(strBody, iCredits, url.URL).Trim();
  215.  
  216.       if (iGenre >= 0)
  217.         movieDetails.Genre = ParseGenresIMDB(strBody, iGenre, url.URL).Trim();
  218.  
  219.       if (iRating >= 0) // and votes
  220.       {
  221.         iRating += "User Rating:</b>".Length;
  222.         iStart = strBody.IndexOf("<b>", iRating);
  223.         if (iStart >= 0)
  224.         {
  225.           iStart += "<b>".Length;
  226.           iEnd = strBody.IndexOf("/", iStart);
  227.  
  228.           // set rating
  229.           string strRating = strBody.Substring(iStart, iEnd - iStart);
  230.           if (strRating != String.Empty)
  231.             strRating = strRating.Replace('.', ',');
  232.           try
  233.           {
  234.             movieDetails.Rating = (float)System.Double.Parse(strRating);
  235.             if (movieDetails.Rating > 10.0f)
  236.               movieDetails.Rating /= 10.0f;
  237.           }
  238.           catch (Exception)
  239.           {
  240.           }
  241.  
  242.           if (movieDetails.Rating != 0.0f)
  243.           {
  244.             // now, votes
  245.             movieDetails.Votes = "0";
  246.             iStart = strBody.IndexOf("(", iEnd + 2);
  247.             if (iStart > 0)
  248.             {
  249.               iEnd = strBody.IndexOf(" votes</a>)", iStart);
  250.               if (iEnd > 0)
  251.               {
  252.                 iStart += "(<a href=\"ratings\">".Length; // skip the parantese and link before votes
  253.                 movieDetails.Votes = strBody.Substring(iStart, iEnd - iStart).Trim();
  254.               }
  255.             }
  256.           }
  257.         }
  258.       }
  259.  
  260.       if (iTop >= 0) // top rated movie :)
  261.       {
  262.         iTop += "top 250:".Length + 2; // jump space and #
  263.         iEnd = strBody.IndexOf("</a>", iTop);
  264.         string strTop = strBody.Substring(iTop, iEnd - iTop);
  265.         movieDetails.Top250 = System.Int32.Parse(strTop);
  266.       }
  267.       if (iTagLine >= 0)
  268.       {
  269.         iTagLine += "Tagline:</h5>".Length;
  270.         iEnd = strBody.IndexOf("<", iTagLine);
  271.         movieDetails.TagLine = strBody.Substring(iTagLine, iEnd - iTagLine).Trim();
  272.         movieDetails.TagLine = MediaPortal.Util.Utils.stripHTMLtags(movieDetails.TagLine);
  273.         movieDetails.TagLine = HttpUtility.HtmlDecode(movieDetails.TagLine);  // Remove HTML entities like ½
  274.       }
  275.  
  276.       if (iPlotOutline < 0)
  277.       {
  278.         if (iPlotSummary > 0)
  279.         {
  280.           iPlotSummary += "Plot Summary:</h5>".Length;
  281.           iEnd = strBody.IndexOf("<", iPlotSummary);
  282.           movieDetails.PlotOutline = strBody.Substring(iPlotSummary, iEnd - iPlotSummary).Trim();
  283.           movieDetails.PlotOutline = MediaPortal.Util.Utils.stripHTMLtags(movieDetails.PlotOutline);
  284.           movieDetails.PlotOutline = HttpUtility.HtmlDecode(movieDetails.PlotOutline);  // remove HTML entities
  285.         }
  286.       }
  287.       else
  288.       {
  289.         iPlotOutline += "Plot Outline:</h5>".Length;
  290.         iEnd = strBody.IndexOf("<", iPlotOutline);
  291.         movieDetails.PlotOutline = strBody.Substring(iPlotOutline, iEnd - iPlotOutline).Trim();
  292.         movieDetails.PlotOutline = MediaPortal.Util.Utils.stripHTMLtags(movieDetails.PlotOutline);
  293.         movieDetails.PlotOutline = HttpUtility.HtmlDecode(movieDetails.PlotOutline);  // remove HTML entities
  294.         movieDetails.Plot = movieDetails.PlotOutline.Trim();
  295.         movieDetails.Plot = HttpUtility.HtmlDecode(movieDetails.Plot);  // remove HTML entities
  296.       }
  297.  
  298.       if (iImage >= 0)
  299.       {
  300.         iEnd = strBody.IndexOf("\"", iImage);
  301.         movieDetails.ThumbURL = strBody.Substring(iImage, iEnd - iImage).Trim();
  302.       }
  303.  
  304.       //plot
  305.       if (iPlot >= 0)
  306.       {
  307.         string strPlotURL = url.URL + "plotsummary";
  308.         try
  309.         {
  310.           string absoluteUri;
  311.           string strPlotHTML = GetPage(strPlotURL, "utf-8", out absoluteUri);
  312.  
  313.           if (0 != strPlotHTML.Length)
  314.           {
  315.  
  316.             int iPlotStart = strPlotHTML.IndexOf("<p class=\"plotpar\">");
  317.             if (iPlotStart >= 0)
  318.             {
  319.               iPlotStart += "<p class=\"plotpar\">".Length;
  320.  
  321.               int iPlotEnd = strPlotHTML.IndexOf("<i>", iPlotStart); // ends with <i> for person who wrote it or
  322.               if (iPlotEnd < 0) iPlotEnd = strPlotHTML.IndexOf("</p>", iPlotStart); // </p> for end of paragraph
  323.  
  324.               if (iPlotEnd >= 0)
  325.               {
  326.                 movieDetails.Plot = strPlotHTML.Substring(iPlotStart, iPlotEnd - iPlotStart);
  327.                 movieDetails.Plot = MediaPortal.Util.Utils.stripHTMLtags(movieDetails.Plot);
  328.                 movieDetails.Plot = HttpUtility.HtmlDecode(movieDetails.Plot);  // remove HTML entities
  329.               }
  330.             }
  331.           }
  332.         }
  333.         catch (Exception ex)
  334.         {
  335.           MediaPortal.GUI.Library.Log.Error("exception for imdb lookup of {0} err:{1} stack:{2}", strPlotURL, ex.Message, ex.StackTrace);
  336.         }
  337.       }
  338.  
  339.       //cast
  340.       string RegCastBlock = "<table class=\"cast\">.*?</table>";
  341.       string RegActorAndRole = "td class=\"nm\"><a href=./name.*?>(?<actor>.*?)</a><.*?<td class=\"char\">(?<role>.*?)<";
  342.  
  343.       Match castBlock = Regex.Match(strBody, RegCastBlock);
  344.  
  345.       // These are some fallback methods to find the block with the cast, in case something changes on IMDB, these may work reasonably well anyway...
  346.       if (!castBlock.Success)
  347.         castBlock = Regex.Match(strBody, @"redited\scast.*?</table>");
  348.       if (!castBlock.Success)
  349.         castBlock = Regex.Match(strBody, @"first\sbilled\sonly.*?</table>");
  350.       if (!castBlock.Success)
  351.         castBlock = Regex.Match(strBody, @"redited\scast.*?more");
  352.       if (!castBlock.Success)
  353.         castBlock = Regex.Match(strBody, @"first\sbilled\sonly.*?more");
  354.  
  355.       string strCastBlock = castBlock.Value;
  356.  
  357.       MatchCollection mc = Regex.Matches(strCastBlock, RegActorAndRole);
  358.       string strActor = string.Empty;
  359.       string strRole = string.Empty;
  360.  
  361.       foreach (Match m in mc)
  362.       {
  363.         strActor = string.Empty;
  364.         strActor = m.Groups["actor"].Value;
  365.         strActor = MediaPortal.Util.Utils.stripHTMLtags(strActor).Trim();
  366.         strActor = HttpUtility.HtmlDecode(strActor);
  367.  
  368.         strRole = string.Empty;
  369.         strRole = m.Groups["role"].Value;
  370.         strRole = MediaPortal.Util.Utils.stripHTMLtags(strRole).Trim();
  371.         strRole = HttpUtility.HtmlDecode(strRole);
  372.  
  373.         movieDetails.Cast += strActor;
  374.         if (strRole != string.Empty)
  375.           movieDetails.Cast += " as " + strRole;
  376.  
  377.         movieDetails.Cast += "\n";
  378.       }
  379.  
  380.       int iRunTime = strBody.IndexOf("Runtime:");
  381.       if (iRunTime > 0)
  382.       {
  383.         iRunTime += "Runtime:</h5>".Length;
  384.         string runtime = "";
  385.         while (!Char.IsDigit(strBody[iRunTime]) && iRunTime + 1 < strBody.Length)
  386.           iRunTime++;
  387.         if (iRunTime < strBody.Length)
  388.         {
  389.           while (Char.IsDigit(strBody[iRunTime]) && iRunTime + 1 < strBody.Length)
  390.           {
  391.             runtime += strBody[iRunTime];
  392.             iRunTime++;
  393.           }
  394.           try
  395.           {
  396.             movieDetails.RunTime = Int32.Parse(runtime);
  397.           }
  398.           catch (Exception) { }
  399.         }
  400.       }
  401.  
  402.       int mpaa = strBody.IndexOf("MPAA</a>:</h5>");
  403.       if (mpaa > 0)
  404.       {
  405.         mpaa += "MPAA</a>:</h5>".Length;
  406.         int mpaaEnd = strBody.IndexOf("</div>", mpaa);
  407.         if (mpaaEnd > 0)
  408.         {
  409.           movieDetails.MPARating = strBody.Substring(mpaa, mpaaEnd - mpaa);
  410.         }
  411.       }
  412.  
  413.  
  414.       return true;
  415.     }
  416.     catch (Exception ex)
  417.     {
  418.       MediaPortal.GUI.Library.Log.Error("exception for imdb lookup of {0} err:{1} stack:{2}", url.URL, ex.Message, ex.StackTrace);
  419.     }
  420.     return false;
  421.   }
  422.  
  423.   string MediaPortal.Video.Database.IIMDBScriptGrabber.GetName()
  424.   {
  425.     return "IMDB grabber ";
  426.   }
  427.  
  428.   string MediaPortal.Video.Database.IIMDBScriptGrabber.GetLanguage()
  429.   {
  430.     return "EN";
  431.   }
  432.  
  433.   private string GetPage(string strURL, string strEncode, out string absoluteUri)
  434.   {
  435.     string strBody = "";
  436.     absoluteUri = String.Empty;
  437.     Stream ReceiveStream = null;
  438.     StreamReader sr = null;
  439.     WebResponse result = null;
  440.     try
  441.     {
  442.       // Make the Webrequest
  443.       //Log.Info("IMDB: get page:{0}", strURL);
  444.       WebRequest req = WebRequest.Create(strURL);
  445.  
  446.       result = req.GetResponse();
  447.       ReceiveStream = result.GetResponseStream();
  448.  
  449.       // Encoding: depends on selected page
  450.       Encoding encode = System.Text.Encoding.GetEncoding(strEncode);
  451.       sr = new StreamReader(ReceiveStream, encode);
  452.       strBody = sr.ReadToEnd();
  453.  
  454.       absoluteUri = result.ResponseUri.AbsoluteUri;
  455.     }
  456.     catch (Exception)
  457.     {
  458.       //Log.Error("Error retreiving WebPage: {0} Encoding:{1} err:{2} stack:{3}", strURL, strEncode, ex.Message, ex.StackTrace);
  459.     }
  460.     finally
  461.     {
  462.       if (sr != null)
  463.       {
  464.         try
  465.         {
  466.           sr.Close();
  467.         }
  468.         catch (Exception)
  469.         {
  470.         }
  471.       }
  472.       if (ReceiveStream != null)
  473.       {
  474.         try
  475.         {
  476.           ReceiveStream.Close();
  477.         }
  478.         catch (Exception)
  479.         {
  480.         }
  481.       }
  482.       if (result != null)
  483.       {
  484.         try
  485.         {
  486.           result.Close();
  487.         }
  488.         catch (Exception)
  489.         {
  490.         }
  491.       }
  492.     }
  493.     return strBody;
  494.   } // END GetPage()
  495.   string ParseAHREFIMDB(string strBody, int iahref, string strURL)
  496.   {
  497.     int iStart = strBody.IndexOf("<a href=\"", iahref);
  498.     if (iStart < 0)
  499.       iStart = strBody.IndexOf("<A HREF=\"", iahref);
  500.     if (iStart < 0)
  501.       return "";
  502.  
  503.     int iEnd = strBody.IndexOf("</a>", iStart);
  504.     if (iEnd < 0)
  505.       iEnd = strBody.IndexOf("</A>", iStart);
  506.     if (iEnd < 0)
  507.       return "";
  508.  
  509.     iStart += "<a href=\"".Length;
  510.     int iSep = strBody.IndexOf(">", iStart);
  511.     string strurl = strBody.Substring(iStart, (iSep - iStart) - 1);
  512.     iSep++;
  513.     string strTitle = strBody.Substring(iSep, iEnd - iSep);
  514.     strTitle = MediaPortal.Util.Utils.stripHTMLtags(strTitle);
  515.     HTMLUtil htmlUtil = new HTMLUtil();
  516.     htmlUtil.ConvertHTMLToAnsi(strTitle, out strTitle);
  517.     strTitle = strTitle.Trim();
  518.     return strTitle.Trim();
  519.  
  520.   }
  521.   string ParseGenresIMDB(string strBody, int iGenre, string url)
  522.   {
  523.     string strTmp;
  524.     string strTitle = "";
  525.     string strHRef = strBody.Substring(iGenre);
  526.     int iSlash = strHRef.IndexOf(" / ");
  527.     int iEnd = 0;
  528.     int iStart = 0;
  529.     if (iSlash >= 0)
  530.     {
  531.       int iRealEnd = strHRef.IndexOf(">more<");
  532.       if (iRealEnd < 0)
  533.         iRealEnd = strHRef.IndexOf("</div>");
  534.       while (iSlash < iRealEnd)
  535.       {
  536.         iStart = iEnd + 2;
  537.         iEnd = iSlash;
  538.         int iLen = iEnd - iStart;
  539.         if (iLen < 0)
  540.           break;
  541.         strTmp = strHRef.Substring(iStart, iLen);
  542.         strTitle = strTitle + ParseAHREFIMDB(strTmp, 0, "") + " / ";
  543.  
  544.         iSlash = strHRef.IndexOf(" / ", iEnd + 2);
  545.         if (iSlash < 0)
  546.           iSlash = iRealEnd;
  547.       }
  548.     }
  549.     // last genre
  550.     iEnd += 2;
  551.     strTmp = strHRef.Substring(iEnd);
  552.     strTitle = strTitle + ParseAHREFIMDB(strTmp, 0, "");
  553.     HTMLUtil htmlUtil = new HTMLUtil();
  554.     htmlUtil.ConvertHTMLToAnsi(strTitle, out strTitle);
  555.  
  556.     return strTitle;
  557.   }
  558.  
  559. }